#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib
import urllib
url="127.0.0.1"
conn=httplib.HTTPConnection(url,80)
#conn.set_debuglevel(2)
data=urllib.urlencode({'name':'jenking','age':'26'})
data2=urllib.urlencode({'name':'python','age':'26'})
headers={'Host':url,
         'Content-type':'application/x-www-form-urlencoded',
         'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.154 Safari/537.36',
         'Accept':'text/plain'
}

fullUrl='/phpDemo/test.php'
fullUrl2='/phpDemo/test2.php?'+data2

#conn.request('POST',fullUrl,data,headers)
conn.request('GET',fullUrl2,None,headers)

respond = conn.getresponse()
print respond.read()
conn.close()
